<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content">
    <button class="btn btn-info pull-right" onclick="exportBySearch(this)">导出</button>
    <img th:src="@{/img/downloadding.gif}" class="btn btn-info pull-right" id="btn_tips" style="display: none"/>
    <form id='queryForm' method="post" style="display: none">
        <input type="hidden"  name="sheetid" th:value="${selectOne.id}">
        <input type="hidden"  name="sheetType" th:value="${selectOne.sheetType}">
    </form>
    <div class="row" style="margin-top: 64px">
        <div class="col-xs-10 col-xs-offset-1">
            <table class="t1" id="t1">
                <thead style="display: table-header-group">
                <tr>
                    <td colspan="13">
                        <img height="40px" style="margin-top: -30px" th:src="@{/img/logo3.jpg}" width="64px">
                        <div style="display: inline-block;margin-top: 5px;margin-left: 20px">
                            <span style="letter-spacing: 24px;display: block;line-height: 20px;font-size: 12px ">&nbsp;辽宁忠旺机械设备制造有限公司</span>
                            <span style="display: block;font-size: 12px;line-height: 20px;font-size: 12px">Liaoning Zhongwang Machinery Equipment Manufacturing Co., Ltd</span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="13" style="font-size: 16px;letter-spacing: 4px;">
                        <span th:if="${selectOne.reportType == 1}">外购件计划单</span>
                        <span th:if="${selectOne.reportType == 2}">外协件计划单</span>
                        <span th:if="${selectOne.reportType == 3}">原材料计划单</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="width: 8%;font-size: 12px">项目编号</td>
                    <td style="width: 10%;font-size: 12px">
                        [[${selectOne.proCode}]]
                    </td>
                    <td style="width: 8%;font-size: 12px">项目名称</td>
                    <td colspan="3" style="width: 30%;font-size: 12px">
                        [[${selectOne.proName}]]
                    </td>
                    <td style="width: 8%;font-size: 12px">项目数量</td>
                    <td style="width: 6%;font-size: 12px">
                        [[${selectOne.proNum}]]
                    </td>
                    <td style="width: 6%;font-size: 12px">类型</td>
                    <td style="width: 9%;font-size: 12px">
                        [[${selectOne.malType}]]
                    </td>
                    <td style="width: 6%;font-size: 12px">部分</td>
                    <td style="width: 9%;font-size: 12px">
                        [[${selectOne.part}]]
                    </td>
                </tr>
                <tr th:if="${selectOne.sheetType== 1}">
                    <td style="width: 4%;">序号</td>
                    <td colspan="3">物料描述</td>
                    <td colspan="2">数量</td>
                    <td style="width: 8%">单位</td>
                    <td colspan="2">型号</td>
                    <td colspan="2">品牌</td>
                    <td colspan="2">备注</td>
                </tr>
                <tr th:if="${selectOne.changeMark== 0}">
                    <td style="width: 4%;">序号</td>
                    <td colspan="3">物料描述</td>
                    <td colspan="2">数量</td>
                    <td style="width: 8%">单位</td>
                    <td colspan="2">型号</td>
                    <td colspan="2">品牌</td>
                    <td colspan="2">备注</td>
                </tr>
                <tr th:if="${selectOne.sheetType== 2}">
                    <td></td>
                    <td style="width: 4%;">序号</td>
                    <td colspan="2">物料描述</td>
                    <td colspan="1">数量</td>
                    <td style="width: 8%">单位</td>
                    <td colspan="2">型号</td>
                    <td colspan="2">品牌</td>
                    <td colspan="2">备注</td>
                    <td colspan="2">变更原因</td>
                </tr>
                </thead>
                <tbody th:if="${selectOne.sheetType== 1}">
                <tr th:each="plan : ${selectAll}">
                    <td th:text="${planStat.count}">1</td>
                    <td colspan="3" style="text-align:left;" th:text="${plan.malDesc}"></td>
                    <td colspan="2" th:text="${T(com.zw.mes.util.BigDecimalUtils).valueFormat(plan.num)}"></td>
                    <td th:text="${plan.unit}"></td>
                    <td colspan="2" th:text="${plan.standard}"></td>
                    <td colspan="2" th:text="${plan.brand}"></td>
                    <td colspan="3" th:text="${plan.remark}"></td>
                </tr>
                </tbody>

                <tbody th:if="${selectOne.changeMark== 0}">
                <tr th:each="plan : ${selectAll}">
                    <td th:text="${planStat.count}">1</td>
                    <td colspan="3" style="text-align:left;" th:text="${plan.malDesc}"></td>
                    <td colspan="2" th:text="${T(com.zw.mes.util.BigDecimalUtils).valueFormat(plan.splitNum)}"></td>
                    <td th:text="${plan.unit}"></td>
                    <td colspan="2" th:text="${plan.standard}"></td>
                    <td colspan="2" th:text="${plan.brand}"></td>
                    <td colspan="3" th:text="${plan.remark}"></td>
                </tr>
                </tbody>


                <tbody th:if="${selectOne.sheetType== 2}">
                <tr th:each="plan : ${selectAll}">
                    <td th:if="${planStat.index == 0}" th:rowspan="${planStat.size}">更改前</td>
                    <td th:text="${planStat.count}">1</td>
                    <td colspan="2" th:text="${plan.malDesc}"></td>
                    <td colspan="1" th:text="${T(com.zw.mes.util.BigDecimalUtils).valueFormat(plan.num)}"></td>
                    <td th:text="${plan.unit}"></td>
                    <td colspan="2" th:text="${plan.standard}"></td>
                    <td colspan="2" th:text="${plan.brand}"></td>
                    <td colspan="2" th:text="${plan.remark}"></td>
                    <td colspan="2"></td>
                </tr>
                <tr th:class="${planStat.index == 0 ? 'after-tr' : ''}" th:each="plan : ${selectAll}">
                    <td th:if="${planStat.index == 0}" th:rowspan="${planStat.size}">更改后</td>
                    <td th:text="${planStat.count}">1</td>
                    <td colspan="2" th:text="${plan.afterMalDesc}"></td>
                    <td colspan="1" th:text="${T(com.zw.mes.util.BigDecimalUtils).valueFormat(plan.afterNum)}"></td>
                    <td th:text="${plan.afterUnit}"></td>
                    <td colspan="2" th:text="${plan.afterStandard}"></td>
                    <td colspan="2" th:text="${plan.afterBrand}"></td>
                    <td colspan="2" th:text="${plan.afterRemark}"></td>
                    <td colspan="2" th:text="${plan.changeReason}"></td>
                </tr>
                </tbody>
            </table>
            <div class="row" style="font-size: 14px;line-height: 200%;">
                <div class="col-xs-3" style="padding-left: 0;font-size: 12px">提报人：[[${selectOne.postName}]]&nbsp;&nbsp;[[${#dates.format(selectOne.createTime,'yyyy.MM.dd')}]]</div>
                <div class="col-xs-3" style="font-size: 12px">联系电话：[[${selectOne.postTel}]]</div>
                <div class="col-xs-3" style="font-size: 12px">审核：<span style="font-size: 12px">[[${selectOne.reviewer}]]&nbsp;&nbsp;[[${#dates.format(selectOne.rtime,'yyyy.MM.dd')}]]</span>
                </div>
                <div class="col-xs-3" style="font-size: 12px">批准：<span style="font-size: 12px">[[${selectOne.verifier}]]&nbsp;&nbsp;[[${#dates.format(selectOne.vtime,'yyyy.MM.dd')}]]</span>
                </div>
            </div>
        </div>
        <div class="col-xs-1">
            <table class="t2" id="t2" th:if="${selectOne.sheetType== 1}">
                <thead style="display: table-header-group">
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                </thead>
                <tbody>
                <tr th:each="plan : ${selectAll}">
                    <td style="text-align: left">
                        <a style="margin-left: -10px" target="_blank" th:href="@{'/purch/downloadProjectFileOrig/'+${plan.id}}"
                           th:if="${plan.url != null}">附件</a>
                        <span th:if="${plan.url == null}">&nbsp;</span>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="col-xs-1">
            <table class="t2" id="t3" th:if="${selectOne.changeMark== 0}">
                <thead style="display: table-header-group">
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                </thead>
                <tbody>
                <tr th:each="plan : ${selectAll}">
                    <td style="text-align: left">
                        <a style="margin-left: -10px" target="_blank" th:href="${plan.extendUrl}"
                           th:if="${plan.extendUrl != null}">附件</a>
                        <span th:if="${plan.extendUrl == null}">&nbsp;</span>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>


        <div class="col-xs-1" th:if="${selectOne.sheetType== 2}">
            <table class="t2" id="t4">
                <thead style="display: table-header-group">
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                </thead>
                <tbody>
                <tr th:each="plan : ${selectAll}">
                    <td style="text-align: left">
                        <a style="margin-left: -10px" target="_blank" th:href="@{'/purch/downloadProjectFile/'+${plan.id}}"
                           th:if="${plan.url != null}">附件</a>
                    </td>
                </tr>
                <tr th:each="plan : ${selectAll}">
                    <td style="text-align: left">
                        <a style="margin-left: -10px" target="_blank" th:href="@{'/purch/downloadProjectFileAfter/'+${plan.id}}"
                           th:if="${plan.afterUrl != null}">附件</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    $(function () {
        $("#t1 tr").each(function (i, v) {
            $("#t2 tr").eq(i).find("td").first().height($(this).find("td:first").height());
        })

        $("#t1 tr").each(function (i, v) {
            $("#t3 tr").eq(i).find("td").first().height($(this).find("td:first").height());
        })

        $("#t1 thead tr").each(function (i, v) {
            $("#t4 thead tr").eq(i).find("td").first().height($(this).find("td:first").height());
        })

        $("#t1 tbody tr").each(function (i, v) {
            $("#t4 tbody tr").eq(i).find("td").first().height($(this).find("td:last").height());
        })

    });

    /**
     * 根据搜索条件导出Excel
     */
    function exportBySearch(obj) {
        $(obj).hide();
        $("#btn_tips").show();
        $("#queryForm").attr("action", "/purch/prodOrdQuery/exportExcelBySearch");
        $("#queryForm").submit();
        setTimeout(function () {
            $("#queryForm").removeAttr("action");
            $(obj).show()
        }, 3000);
        $("#btn_tips").hide();
        $("#exportBySearch").show();
    }

</script>
</body>
</html>
